Repository navigation
Extract lists of objects with nested fields - #5
Merged
Merged
Conversation
Field.Kind.object groups fields, so extract steps and tool parameters can ask for records such as the lines of an order. Each named schema node now gets its own name, since repeated names replaced each other's definitions.
7 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 What
Adds
Field.Kind.object([Field]), soextractsteps and tool parameters can ask for records, such as.list(.object([...]))for the lines of an order. Each object reads as a dictionary.🤔 Why
Turning free text into actions over app state ("two beers, no cola") needs a list of records with several fields each. With text, number, bool, choice and list only, a host had to flatten records into parallel lists or JSON text.
While nesting, a latent schema bug showed up: AnyLanguageModel stores named nodes (objects and choices) as shared
$defskeyed by name, and a later node with the same name silently replaces the earlier one. Nested fields repeat names often (kind,name), and a tool named like one of its choice parameters already hit it.SchemaBuildernow gives each named node its own name (kind,kind2, …).🧪 How it was tested
NestedFieldTests: an extract step returning a list of objects throughScriptedModel; repeated names keep separate definitions in the encoded schema; empty objects and duplicate nested names are preflight issues; workflows with objects round-trip as JSON.LiveAppleTests.onDeviceModelExtractsListsOfObjects: Apple's on-device model fills.list(.object(...))correctly on macOS 27 (RELAY_LIVE=1), so nested$defssurvive the Foundation Models bridge.make check-style,make check-skill, and an iOS build of the four libraries.✅ Checklist
make formatandmake check-stylepass.env -u RELAY_LIVE swift test -Xswiftc -warnings-as-errorspasses.ScriptedModel/StubProtocol, without live services or keys.CHANGELOG.mdunderUnreleased.📣 Notes for review
Field.Kindbreaks host code that switches over it withoutdefault. Pre-1.0, this ships in a minor release..objectencodes like the other cases.Field+Validation.swift(schemaProblems), which shortensvalidationIssues. Itsfunction_body_lengthbaseline entry goes from 107 to 94 lines, and the staleSchemaBuilderentry is removed..objectnext.